package main

import (
	"honghu_be/handler"
)

func Register() {
	r.Use(Cors())
	r.GET("/ping", handler.Ping)

	b := r.Group("/box")
	{
		b.GET("", handler.GetBoxes)
		b.POST("", handler.CreateBox)
		b.DELETE("/:box_id", handler.DeleteBox)
		b.GET("/:box_id", handler.GetBox)
		b.PATCH("", handler.UpdateBox)
	}

	ad := r.Group("/ad")
	{
		ad.GET("", handler.GetAds)
		ad.GET("/:ad_id", handler.GetAd)
		ad.POST("", handler.CreateAd)
		ad.DELETE("/:ad_id", handler.DeleteAd)
		ad.PATCH("", handler.UpdateAd)
	}

	article := r.Group("/article")
	{
		article.GET("", handler.GetArticles)
		article.GET("/:article_id", handler.GetArticle)
		article.POST("", handler.CreateArticle)
		article.DELETE("/:article_id", handler.DeleteArticle)
		article.PATCH("", handler.UpdateArticle)
	}
}
